<template>
	<view class="my-store-info">
		<view class="store-box">
			<view class="store-form">
				<u-cell-group>
					<u-cell title="公司名称" v-if="isCompany==true">
						<view class="text" slot="value">{{authInfo.companyName}}</view>
					</u-cell>
					<u-cell title="法人姓名" v-if="isCompany==true">
						<view class="text" slot="value">{{authInfo.legalPerson}}</view>
					</u-cell>
					<u-cell title="营业执照号" v-if="isCompany==true">
						<view class="text" slot="value">{{authInfo.companyId}}</view>
					</u-cell>
					<u-cell title="证件号" v-if="isCompany==false">
						<view class="text" slot="value">{{authInfo.cardId}}</view>
					</u-cell>
					<u-cell title="证件姓名" v-if="isCompany==false">
						<view class="text" slot="value">{{authInfo.cardName}}</view>
					</u-cell>
					<u-cell title="手机号">
						<u--input slot="value" placeholder="请输入和法人姓名一致的手机号" fontSize="14px" type="number" border="none"
							v-model="authInfo.phone"></u--input>
					</u-cell>
				</u-cell-group>
			</view>
		</view>







		<view class="btn" @tap="submit">确定</view>
	</view>
</template>

<script>
	const app = getApp();
	const globalData = app.globalData;
	const apiUrl = globalData.wxApi;
	const wxImg = globalData.wxImg;
	let deviceInfo = {};
	uni.getSystemInfo({
		success: res => {
			console.log(res)
			deviceInfo = res;
		}
	});
	import {
		getStoreData,
		dealNum,
		httpPost,
		httpGet,
		bdMapToTxMap,
		txMapToBdMap,
	} from "@/utils/http.js";
	import mpMixin from "@/uni_modules/uview-ui/libs/mixin/mpMixin";
	const pic1 = require(`@/img/my/my1.png`);



	export default {
		data() {
			return {
				wxImg,
				apiUrl,
				dealNum,
				pic1,
				cityFlag: false,
				authInfo: {
					companyId: "",
					companyName: "",
					legalPerson: "",
					phone: "",
					cardName: "",
					cardId: ""
				},
				subscriptionInfo: {

				},
				isCompany: false

			};
		},

		onShow() {

		},
		onUnload() {

		},
		onLoad(options) {
			this.subscriptionInfo = JSON.parse(options.infoStr);
			if (this.subscriptionInfo.companyCertificate && JSON.stringify(this.subscriptionInfo.companyCertificate) !=
				'{}') {
				this.authInfo.companyId = this.subscriptionInfo.companyCertificate.companyId;
				this.authInfo.companyName = this.subscriptionInfo.companyCertificate.companyName;
				this.authInfo.legalPerson = this.subscriptionInfo.companyCertificate.legalPerson;
				this.isCompany = true;

			} else {
				this.authInfo.cardId = this.subscriptionInfo.personalCertificate.cardId;
				this.authInfo.cardName = this.subscriptionInfo.personalCertificate.cardName;
				this.isCompany = false;
			}
		},
		methods: {

			submit() {
				let that = this;
				if(!this.authInfo.phone){
					uni.$u.toast("手机号不能为空");
					return
				}
				if(!this.subscriptionInfo.contractType){
					uni.$u.toast("类型不能为空");
					return
				}
				if(!this.subscriptionInfo.id){
					uni.$u.toast("id不能为空");
					return
				}
				httpPost("/api/sellerstoreagreement/updateRealApprove", {
						contractType: this.subscriptionInfo.contractType,
						id: this.subscriptionInfo.id,
						phone: this.authInfo.phone
					})
					.then((res) => {
						uni.navigateBack();
					})
					.catch((e) => {});
			}
		},
	};
</script>

<style lang="scss">
	.my-store-info {
		background-color: #f4f5f7;
		padding-top: 20rpx;
	}

	.store-box {
		width: 650rpx;
		margin-left: 30rpx;
		background-color: #fff;
		border-radius: 20rpx;
		margin-bottom: 20rpx;
		padding: 20rpx;

		.title {
			font-size: 28rpx;
			font-weight: bold;
			margin-bottom: 20rpx;
		}
	}

	/deep/ .u-cell__title-text {
		font-size: 28rpx;
	}

	/deep/ .u-input {
		flex: 2
	}

	.scroll-Y {
		max-height: 90vh;
	}

	.tylist {
		padding: 30rpx;


		.li {
			padding-top: 20rpx;
			padding-bottom: 20rpx;
			font-size: 28rpx;
			border-bottom: 2rpx solid #f4f5f7;
		}

		.li-one-box {

			.li-one-title {
				padding-top: 20rpx;
				padding-bottom: 20rpx;
				font-size: 28rpx;
				border-bottom: 2rpx solid #f4f5f7;
			}

			.li-two-box {
				margin-left: 20rpx;

				.li-two-title {
					padding-top: 20rpx;
					padding-bottom: 20rpx;
					font-size: 28rpx;
					border-bottom: 2rpx solid #f4f5f7;
				}

				.li-three-box {
					margin-left: 30rpx;

					.li-three-title {
						padding-top: 20rpx;
						padding-bottom: 20rpx;
						font-size: 28rpx;
						border-bottom: 2rpx solid #f4f5f7;
					}
				}
			}
		}
	}

	.btn {
		width: 690rpx;
		height: 100rpx;
		line-height: 100rpx;
		font-weight: bold;
		color: #fff;
		text-align: center;
		background: linear-gradient(to right, #3CBAF6, #56D1FC);
		margin-left: 30rpx;
	}
</style>